﻿namespace Snipps
{
    using System.Configuration;

    using Snipps.Infrastructure;
    using Snipps.Properties;

    public class AppSettings : ISettings
    {
        public AppSettings()
        {
            var portableSettingsProvider = new PortableSettingsProvider();
            Settings.Default.Providers.Add(portableSettingsProvider);
            foreach (SettingsProperty prop in Settings.Default.Properties)
            {
                prop.Provider = portableSettingsProvider;
            }

            Settings.Default.Reload();
        }

        public int AutoSaveTimeInterval
        {
            get
            {
                return Settings.Default.AutoSaveTimeInterval;
            }

            set
            {
            }
        }

        public void Save()
        {
            Settings.Default.Save();
        }

        public bool TempFileIsUsed
        {
            get
            {
                return Settings.Default.TempFileUsed;
            }

            set
            {
                Settings.Default.TempFileUsed = value;
            }
        }
    }
}